﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace StoreWeb.system.memberManage
{
    public partial class edit : System.Web.UI.Page
    {
        //BLL.Role role = new BLL.Role();
        BLL.member members = new BLL.member();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Bind();
                hidid.Value = Request.QueryString["id"];
                if (!string.IsNullOrEmpty(hidid.Value))
                {
                    Model.member ne = members.GetModel(Convert.ToInt32(hidid.Value));
                    username.Value = ne.name;
                    mobile.Value = ne.mobile;
                    s_province.Value = ne.s_province;
                    s_city.Value = ne.s_city;
                    s_county.Value = ne.s_county;
                    address.Value = ne.address;
                    emal.Value = ne.emal;
                    birthday.Value = ne.birthday;
                    constellation.Value = ne.constellation;
                    weight.Value = ne.weight;
                    height.Value = ne.height;

                    ddlmemberGrade.SelectedValue = ne.membergrade.ToString();

                    if (ne.sex == 0)
                    {
                        radSex0.Checked = true;
                    }
                    if (ne.sex==1)
                    {
                        radSex1.Checked = true;
                    }
                    if (ne.sex == 2)
                    {
                        radSex2.Checked = true;
                    }

                    if (ne.isvip == "0")
                    {
                        RadioButton1.Checked = true;
                    }
                    if (ne.isvip == "1")
                    {
                        RadioButton2.Checked = true;
                    }

                }
            }
        }

        private void Bind()
        {
            BLL.memberGrade message = new BLL.memberGrade();
            //加载等级
            ddlmemberGrade.DataSource = message.GetList(" ");
            ddlmemberGrade.DataTextField = "grade";
            ddlmemberGrade.DataValueField = "grade";
            ddlmemberGrade.DataBind();
            ddlmemberGrade.Items.Insert(0, new ListItem { Value = "0", Text = "------请分配等级------" });

        }
    }
}